package pattern10.boss;

import java.util.ArrayList;
import java.util.List;

/**
 * @author wdl
 */
public class Boss implements ISubject {
    private List<BaseObserver> observers=new ArrayList<>();
    private String action;
    @Override
    public void Attach(BaseObserver observer) {
        observers.add(observer);
    }

    @Override
    public void Detach(BaseObserver observer) {
        observers.remove(observer);
    }

    @Override
    public void Notify() {
        for (BaseObserver observer:observers){
            observer.update();
        }
    }

    @Override
    public String getAction() {
        return action;
    }

    @Override
    public void setAction(String action) {
        this.action=action;
    }
}
